package com.eclipse.e0112_io.字节流字符流;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class FileInputStreamTest {
	
	public static void main(String[] args) throws IOException {

		File file = new File("/Users/liuzhuangzhuang/Desktop/io/b.txt");
		FileInputStream fileInputStream = new FileInputStream(file);
		
		if (file.exists()) {
			
			int byteNum = 0;
			byte[] byteArray = new byte[3];
				
			while (byteNum != -1) {
				byteNum = fileInputStream.read(byteArray);
				System.out.println("bytenum:" + byteNum);
				for (int i = 0; i < byteNum; i++) {
					System.out.println(byteArray[i]);//强制转换成char 字节变成字符
				}
			}
		}
	}
}